home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer 7.42 / PC Gamer CD-ROM 7.42 (July 2004).iso / Data / items.pcg / scripts / frame_1 / DoAction.as
Text File  |  2004-04-23  |  12KB  |  318 lines

  1. function SwitchTab(whichTab, whichMenuText, whichVarText, numItems, theLastButton, whichFrame, scrollCount, selectScrollCount)
  2. {
  3.    if(whichTab != currentTab)
  4.    {
  5.       EasterEggIsOn = false;
  6.       screenflag2 = 0;
  7.       startingTab = true;
  8.       currentTab = whichTab;
  9.       num_Items = numItems;
  10.       setProperty("itemBar" + lastButton, _alpha, 10);
  11.       if(scrollcount == selectScrollCount)
  12.       {
  13.          setProperty("ItemBar" + theLastButton, _alpha, 20);
  14.       }
  15.       _level4.gotoAndStop(2);
  16.       lastButton = theLastButton;
  17.       if(whichTab == 2)
  18.       {
  19.          if(currentExtraMode == 0)
  20.          {
  21.             gotoAndPlay(whichFrame);
  22.          }
  23.          else
  24.          {
  25.             gotoAndPlay(9);
  26.          }
  27.       }
  28.       else
  29.       {
  30.          gotoAndPlay(whichFrame);
  31.       }
  32.    }
  33. }
  34. function selectItem(theBoxNum, theItemNum, theLastButton, theCurrentItem, whichFrame, scrollCount, selectScrollCount, theBoxVar)
  35. {
  36.    if((theLastButton != theBoxNum | scrollcount != eval(selectScrollCount)) & Number(theItemNum) != 0)
  37.    {
  38.       EasterEggIsOn = false;
  39.       screenflag2 = 1;
  40.       if(_level5.soundFlagValue)
  41.       {
  42.          buttSound.start();
  43.       }
  44.       _level4.gotoAndStop(2);
  45.       setProperty("itemBar" + (theBoxNum + maxScroll * scrollCount), _alpha, 20);
  46.       if(scrollCount == eval(selectScrollCount))
  47.       {
  48.          setProperty("itemBar" + theLastButton, _alpha, 10);
  49.       }
  50.       set(theBoxVar,theBoxNum);
  51.       lastButton = theBoxNum;
  52.       set(theCurrentItem,theItemNum);
  53.       set(selectScrollCount,scrollCount);
  54.       if(currentTab == 2)
  55.       {
  56.          if(eval("extratype" + theItemNum) == "All Images are 1024x768")
  57.          {
  58.             gotoAndPlay(9);
  59.             currentExtraMode = 1;
  60.          }
  61.          else
  62.          {
  63.             gotoAndPlay(whichFrame);
  64.             currentExtraMode = 0;
  65.          }
  66.       }
  67.       else
  68.       {
  69.          gotoAndPlay(whichFrame);
  70.       }
  71.    }
  72. }
  73. function scrollListDown(whichVar, whichItem, whichItemNum, numItems, top_Item, top_ItemName, scrollCount, scrollCountName, selectedScroll)
  74. {
  75.    if(numItems - scrollMax >= top_Item)
  76.    {
  77.       var theNewTop = Number(top_Item + scrollMax);
  78.       setProperty("itemBar" + lastButton, _alpha, 10);
  79.       if(currentTab != 4)
  80.       {
  81.          set(whichVar + 1,eval(whichItem + (top_Item + scrollMax)));
  82.          set(whichVar + 2,eval(whichItem + (top_Item + (scrollMax + 1))));
  83.          set(whichVar + 3,eval(whichItem + (top_Item + (scrollMax + 2))));
  84.          set(whichVar + 4,eval(whichItem + (top_Item + (scrollMax + 3))));
  85.          set(whichVar + 5,eval(whichItem + (top_Item + (scrollMax + 4))));
  86.          set(whichVar + 6,eval(whichItem + (top_Item + (scrollMax + 5))));
  87.          set(whichVar + 7,eval(whichItem + (top_Item + (scrollMax + 6))));
  88.          set(whichVar + 8,eval(whichItem + (top_Item + (scrollMax + 7))));
  89.          set(whichVar + 9,eval(whichItem + (top_Item + (scrollMax + 8))));
  90.       }
  91.       else
  92.       {
  93.          set(whichVar + 1,eval(whichItem + (top_Item - 1 + scrollMax)));
  94.          set(whichVar + 2,eval(whichItem + (top_Item - 1 + (scrollMax + 1))));
  95.          set(whichVar + 3,eval(whichItem + (top_Item - 1 + (scrollMax + 2))));
  96.          set(whichVar + 4,eval(whichItem + (top_Item - 1 + (scrollMax + 3))));
  97.          set(whichVar + 5,eval(whichItem + (top_Item - 1 + (scrollMax + 4))));
  98.          set(whichVar + 6,eval(whichItem + (top_Item - 1 + (scrollMax + 5))));
  99.          set(whichVar + 7,eval(whichItem + (top_Item - 1 + (scrollMax + 6))));
  100.          set(whichVar + 8,eval(whichItem + (top_Item - 1 + (scrollMax + 7))));
  101.          set(whichVar + 9,eval(whichItem + (top_Item - 1 + (scrollMax + 8))));
  102.       }
  103.       set(top_ItemName,theNewTop);
  104.       set(scrollCountName,scrollCount + 1);
  105.       if(currentTab == 1)
  106.       {
  107.          theBox1._y = 224 + 160 * ((scrollCount + 1) / int(numItems / scrollMax + 1));
  108.          DemoBox_y = theBox1._y;
  109.       }
  110.       if(currentTab == 2)
  111.       {
  112.          theBox2._y = 224 + 160 * ((scrollCount + 1) / int(numItems / scrollMax + 1));
  113.          ExtraBox_y = theBox2._y;
  114.       }
  115.       if(currentTab == 3)
  116.       {
  117.          theBox3._y = 224 + 160 * ((scrollCount + 1) / int(numItems / scrollMax + 1));
  118.          FileBox_y = theBox3._y;
  119.       }
  120.       if(currentTab == 4)
  121.       {
  122.          theBox._y = 224 + 160 * (scrollCount / int(numItems / scrollMax + 1));
  123.          GameBox_y = theBox._y;
  124.       }
  125.       var tempScroll = Number(scrollCount + 1);
  126.       if(tempScroll == selectedScroll)
  127.       {
  128.          setProperty("itemBar" + lastButton, _alpha, 20);
  129.       }
  130.       set(whichItemNum + 1,theNewTop);
  131.       set(whichItemNum + 2,theNewTop + 1);
  132.       set(whichItemNum + 3,theNewTop + 2);
  133.       set(whichItemNum + 4,theNewTop + 3);
  134.       set(whichItemNum + 5,theNewTop + 4);
  135.       set(whichItemNum + 6,theNewTop + 5);
  136.       set(whichItemNum + 7,theNewTop + 6);
  137.       set(whichItemNum + 8,theNewTop + 7);
  138.       set(whichItemNum + 9,theNewTop + 8);
  139.    }
  140. }
  141. function scrollListUp(whichVar, whichItem, whichItemNum, numItems, top_Item, top_ItemName, scrollCount, scrollCountName, selectedScroll)
  142. {
  143.    if(1 < top_Item)
  144.    {
  145.       var theNewTop = Number(top_Item - scrollMax);
  146.       setProperty("itemBar" + lastButton, _alpha, 10);
  147.       if(currentTab != 4)
  148.       {
  149.          set(whichVar + 1,eval(whichItem + (top_Item - scrollMax)));
  150.          set(whichVar + 2,eval(whichItem + (top_Item - (scrollMax - 1))));
  151.          set(whichVar + 3,eval(whichItem + (top_Item - (scrollMax - 2))));
  152.          set(whichVar + 4,eval(whichItem + (top_Item - (scrollMax - 3))));
  153.          set(whichVar + 5,eval(whichItem + (top_Item - (scrollMax - 4))));
  154.          set(whichVar + 6,eval(whichItem + (top_Item - (scrollMax - 5))));
  155.          set(whichVar + 7,eval(whichItem + (top_Item - (scrollMax - 6))));
  156.          set(whichVar + 8,eval(whichItem + (top_Item - (scrollMax - 7))));
  157.          set(whichVar + 9,eval(whichItem + (top_Item - (scrollMax - 8))));
  158.       }
  159.       else
  160.       {
  161.          set(whichVar + 1,eval(whichItem + (top_Item - 1 - scrollMax)));
  162.          set(whichVar + 2,eval(whichItem + (top_Item - 1 - (scrollMax - 1))));
  163.          set(whichVar + 3,eval(whichItem + (top_Item - 1 - (scrollMax - 2))));
  164.          set(whichVar + 4,eval(whichItem + (top_Item - 1 - (scrollMax - 3))));
  165.          set(whichVar + 5,eval(whichItem + (top_Item - 1 - (scrollMax - 4))));
  166.          set(whichVar + 6,eval(whichItem + (top_Item - 1 - (scrollMax - 5))));
  167.          set(whichVar + 7,eval(whichItem + (top_Item - 1 - (scrollMax - 6))));
  168.          set(whichVar + 8,eval(whichItem + (top_Item - 1 - (scrollMax - 7))));
  169.          set(whichVar + 9,eval(whichItem + (top_Item - 1 - (scrollMax - 8))));
  170.       }
  171.       set(top_ItemName,theNewTop);
  172.       set(scrollCountName,scrollCount - 1);
  173.       if(currentTab == 1)
  174.       {
  175.          theBox1._y = 224 + 160 * ((scrollCount - 1) / int(numItems / scrollMax + 1));
  176.          DemoBox_y = theBox1._y;
  177.       }
  178.       if(currentTab == 2)
  179.       {
  180.          theBox2._y = 224 + 160 * ((scrollCount - 1) / int(numItems / scrollMax + 1));
  181.          ExtraBox_y = theBox2._y;
  182.       }
  183.       if(currentTab == 3)
  184.       {
  185.          theBox3._y = 224 + 160 * ((scrollCount - 1) / int(numItems / scrollMax + 1));
  186.          FileBox_y = theBox3._y;
  187.       }
  188.       if(currentTab == 4)
  189.       {
  190.          theBox._y = 224 + 160 * ((scrollCount - 2) / int(numItems / scrollMax + 1));
  191.          GameBox_y = theBox._y;
  192.       }
  193.       var tempScroll = Number(scrollCount - 1);
  194.       if(tempScroll == selectedScroll)
  195.       {
  196.          setProperty("itemBar" + lastButton, _alpha, 20);
  197.       }
  198.       set(whichItemNum + 1,theNewTop);
  199.       set(whichItemNum + 2,theNewTop + 1);
  200.       set(whichItemNum + 3,theNewTop + 2);
  201.       set(whichItemNum + 4,theNewTop + 3);
  202.       set(whichItemNum + 5,theNewTop + 4);
  203.       set(whichItemNum + 6,theNewTop + 5);
  204.       set(whichItemNum + 7,theNewTop + 6);
  205.       set(whichItemNum + 8,theNewTop + 7);
  206.       set(whichItemNum + 9,theNewTop + 8);
  207.    }
  208. }
  209. function scrollListBox(whichVar, whichItem, whichItemNum, numItems, top_Item, top_ItemName, scrollCount, scrollCountName, selectedScroll, Box_y, Box_yName)
  210. {
  211.    var theNewTop = (scrollCount + 1) * scrollMax - 8;
  212.    if(currentTab == 4)
  213.    {
  214.       set(whichVar + 1,eval(whichItem + (theNewTop - 1)));
  215.       set(whichVar + 2,eval(whichItem + theNewTop));
  216.       set(whichVar + 3,eval(whichItem + (theNewTop + 1)));
  217.       set(whichVar + 4,eval(whichItem + (theNewTop + 2)));
  218.       set(whichVar + 5,eval(whichItem + (theNewTop + 3)));
  219.       set(whichVar + 6,eval(whichItem + (theNewTop + 4)));
  220.       set(whichVar + 7,eval(whichItem + (theNewTop + 5)));
  221.       set(whichVar + 8,eval(whichItem + (theNewTop + 6)));
  222.       set(whichVar + 9,eval(whichItem + (theNewTop + 7)));
  223.    }
  224.    else
  225.    {
  226.       set(whichVar + 1,eval(whichItem + theNewTop));
  227.       set(whichVar + 2,eval(whichItem + (theNewTop + 1)));
  228.       set(whichVar + 3,eval(whichItem + (theNewTop + 2)));
  229.       set(whichVar + 4,eval(whichItem + (theNewTop + 3)));
  230.       set(whichVar + 5,eval(whichItem + (theNewTop + 4)));
  231.       set(whichVar + 6,eval(whichItem + (theNewTop + 5)));
  232.       set(whichVar + 7,eval(whichItem + (theNewTop + 6)));
  233.       set(whichVar + 8,eval(whichItem + (theNewTop + 7)));
  234.       set(whichVar + 9,eval(whichItem + (theNewTop + 8)));
  235.    }
  236.    setProperty("itemBar" + lastButton, _alpha, 10);
  237.    set(Box_yName,Box_y);
  238.    if(selectedScroll != 0)
  239.    {
  240.       if(scrollCount == selectedScroll - 1)
  241.       {
  242.          setProperty("itemBar" + lastButton, _alpha, 20);
  243.       }
  244.    }
  245.    else if(scrollCount == selectedScroll)
  246.    {
  247.       setProperty("itemBar" + lastButton, _alpha, 20);
  248.    }
  249.    set(top_ItemName,theNewTop);
  250.    set(scrollCountName,scrollCount + 1);
  251.    set(whichItemNum + 1,theNewTop);
  252.    set(whichItemNum + 2,theNewTop + 1);
  253.    set(whichItemNum + 3,theNewTop + 2);
  254.    set(whichItemNum + 4,theNewTop + 3);
  255.    set(whichItemNum + 5,theNewTop + 4);
  256.    set(whichItemNum + 6,theNewTop + 5);
  257.    set(whichItemNum + 7,theNewTop + 6);
  258.    set(whichItemNum + 8,theNewTop + 7);
  259.    set(whichItemNum + 9,theNewTop + 8);
  260. }
  261. loadVariables("Data/demodata.txt","");
  262. loadVariables("Data/extrasdata.txt","");
  263. loadVariables("Data/filesdata.txt","");
  264. loadVariables("Data/databasedata.txt","");
  265. loadMovieNum("Data/Help.pcg",7,"GET");
  266. startTime = getTimer();
  267. startingTab = true;
  268. buttSound = new Sound(_level1);
  269. buttSound.attachSound("myButtonSound");
  270. arGamesDBMain = new Array();
  271. arGamesDBIndex = new Array();
  272. arGamesIndexSlice = new Array();
  273. loadSysTimeOut = 10000;
  274. searchstr = "";
  275. thisprocessor = "";
  276. num_Demos = 0;
  277. num_Extras = 0;
  278. num_Files = 0;
  279. num_Games = 0;
  280. num_Items = 0;
  281. scrollMax = 9;
  282. lastButton = 1;
  283. currentExtraMode = 0;
  284. currentTab = 1;
  285. screenflag1 = 0;
  286. screenflag2 = 0;
  287. theCurrentDemo = 1;
  288. theLastDemo = 1;
  289. theCurrentGame = 1;
  290. theLastGame = 1;
  291. theCurrentExtra = 1;
  292. theLastExtra = 1;
  293. theCurrentFile = 1;
  294. theLastFile = 1;
  295. topDemo = 1;
  296. topExtra = 1;
  297. topFile = 1;
  298. topDB = 1;
  299. EasterEggIsOn = false;
  300. topItem = 1;
  301. clearItem = 0;
  302. currentDemoCount = 1;
  303. currentExtraCount = 1;
  304. currentFileCount = 1;
  305. currentGameCount = 1;
  306. demoCount = 1;
  307. extraCount = 1;
  308. fileCount = 1;
  309. dbCount = 1;
  310. lastDemoBox = 1;
  311. lastExtraBox = 1;
  312. lastFileBox = 1;
  313. lastGameBox = 1;
  314. DemoBox_y = 224;
  315. ExtraBox_y = 224;
  316. FileBox_y = 224;
  317. GameBox_y = 224;
  318.